import { createRouter, createWebHashHistory, createWebHistory, Router } from 'vue-router'
import { routes } from './routes'
// import userStore from '@/store/modules/user'

let router: Router = createRouter({
  history: createWebHashHistory(), // createWebHistory("/poly")
  routes,
  scrollBehavior() {
    return {
      left: 0,
      top: 0,
    }
  },
})

// router.beforeEach((to, from, next) => {
//   console.log('to', to)
//   const store = userStore()
//   if (to.path == '/login') return next()
//   if (!store.token) return next('/login')
//   next()

//   // if (to.path != '/login' && !store.token) return '/login'
//   // if () return '/login'
// })
export default router
